
const { ccclass, property } = cc._decorator;

@ccclass
export default class SetMaterialSize extends cc.Component {

    @property(cc.Sprite)
    icon: cc.Sprite = null

    @property(cc.Slider)
    slider: cc.Slider = null

    protected start(): void {

        let width = this.icon.node.width * this.icon.node.scaleX;
        let height = this.icon.node.height * this.icon.node.scaleY;

        this.icon.getMaterial(0).setProperty('textureSize', [width, height], 0, true);
    }

    private onSliderMove() {
        this.icon.getMaterial(0).setProperty('threshold', this.slider.progress, 0, true);
    }

}
